package main

import "fmt"

func fn1(n int) {
	fmt.Println("fn1", n)
	n--
	if n == 0 {
		return
	}
	fn1(n)
}

func adder() func(int) int {
	var i = 10 // 常驻内存、不污染全局
	return func(y int) int {
		i += y
		return i
	}
}

func main() {
	var a = adder()
	i := a(2)
	fmt.Println(i)
	i = a(3)
	fmt.Println(i)
}
